<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<base href='<%=basePath%>'>
<script src="res/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="res/js/echarts.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>总店商品销售情况</title>
</head>
<body>

<div id="main" style="width: 1200px;height:800px;"></div>

</body>

<script type="text/javascript">
var myChart = echarts.init(document.getElementById('main'));

	var data =[];
	var url = "money/selectWare.action";
	
	$.post(url,null,function(money){
		
		for(var i = 0; i < money.money.length; i++){
			data.push([ money.money[i].num, money.money[i].ware_name]);
			
		}
		
		option = {
			    title : {
			        text: money.year+'年'+money.month+'月总店药品销量图',
			        x:'center'
			    },
			    tooltip : {
			        trigger: 'item',
			        formatter: "{a} <br/>{b} : {c} ({d}%)"
			    },
			    legend: {
			        orient: 'vertical',
			        left: 'left',
			        data:data,
			    },
			    series : [
			        {
			            name: '访问来源',
			            type: 'pie',
			            radius : '55%',
			            center: ['50%', '60%'],
			            data:data,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(1, 1, 1, 1)'
			                }
			            }
			        }
			    ]
			};

		// 使用刚指定的配置项和数据显示图表。
		myChart.setOption(option);

	});


</script>
</html>